package ${baseInfo.packageName};

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import ${tableClass.fullClassName};
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class ${baseInfo.fileName} extends ${tableClass.shortClassName}{


    public static ${baseInfo.fileName} convert(${tableClass.shortClassName} entity){
        ${tableClass.shortClassName}Vo vo = new ${tableClass.shortClassName}Vo();
        BeanUtils.copyProperties(entity,vo);
        return vo;
    }

    public static ${tableClass.shortClassName} convert(${baseInfo.fileName} vo){
        ${tableClass.shortClassName} entity = new ${tableClass.shortClassName}();
        BeanUtils.copyProperties(vo,entity);
        return entity;
    }

    public static List<${baseInfo.fileName}> convertToVos(List<${tableClass.shortClassName}> entityList){
        if (CollectionUtils.isEmpty(entityList)){
            return new ArrayList<>();
        }
        return entityList.stream().map(${tableClass.shortClassName}Vo::convert)
            .collect(Collectors.toList());
    }
    public static List<${tableClass.shortClassName}> convert(List<${baseInfo.fileName}> entityList){
        if (CollectionUtils.isEmpty(entityList)){
            return new ArrayList<>();
        }
        return entityList.stream().map(${tableClass.shortClassName}Vo::convert)
            .collect(Collectors.toList());
    }
}
